import 'package:flutter/material.dart';

class MyApp1 extends StatelessWidget {
  MyApp1({super.key, this.age});

  int? age;

  final String name = '张三';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // 导航条
      appBar: AppBar(
        title: const Text(
          'flutter初体验',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      // 主题区域
      body: Center(child: Text('我的名字叫$name,今年$age岁')),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          age = age! + 1;
          print(age);
        },
      ),
    );
  }
}
